#include "Double_Link_Lis.h"
#include "Element_data.h"

Element_data stu_1[10] = 
{
    {.id = 1 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "唐三"},
    {.id = 2 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "小舞"},
    {.id = 3 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "罗峰"},
    {.id = 4 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "沈欣"},
    {.id = 5 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "萧炎"},
    {.id = 6 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "萧熏儿"},
    {.id = 7 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "叶辰"},
    {.id = 8 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "柳如烟"},
};
Element_data stu_2[10] = 
{
    {.id = 1 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "小帅"},
    {.id = 2 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "小美"},
    {.id = 3 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "卡拉米"},
    {.id = 4 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "大壮"},
    {.id = 5 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "德玛西亚"},
    {.id = 6 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "后羿"},
    {.id = 7 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "太阳神"},
    {.id = 8 , .age = 18 ,.sco = 89 , .sex = "男" , .name = "阿波罗"},
};


void test(void)
{
    // 初始化链表
    Double_Link_List * L1 = init_double_link_list();
    Double_Link_List * L2 = init_double_link_list();
    Double_Link_List * L3;
    
    // 插入数据
    for (size_t i = 0; i < 8; i++)
    {
        insert_double_node( L1 , stu_1[i] , i);
    }
    for (size_t i = 0; i < 8; i++)
    {
        insert_double_node( L2 , stu_2[i] , i);
    }

    // 打印数据
    L3 = merge_double_link_lists(L1 , L2);
    print_double_link_list(L3);

    printf("释放前  L3 = %p\n" , L3);
    _free_double_link_list(&L3);


    printf("释放后  L3 = %p\n" , L3);
    // printf("释放后  L3->next = %p\n" , L3->next);
    
    
}






int main(int argc, char const *argv[])
{
    test();
    return 0;
}


